﻿<Window x:Class="Eswat.Client.Wpf.MainWindow"
		xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
		xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
		xmlns:ribbon="http://schemas.microsoft.com/winfx/2006/xaml/presentation/ribbon"
		Title="Even Simpler Web/Windows Acceptance Testing" WindowState="Maximized" Height="550" Width="525" KeyDown="Window_KeyDown" Cursor="{Binding Cursor, Mode=OneWay}" Icon="/Eswat.Client.Wpf;component/Images/eswat-logo_100x100.png">
	<Grid>
		<Grid.ColumnDefinitions>
			<ColumnDefinition Width="3*" />
			<ColumnDefinition Width="7*" />
		</Grid.ColumnDefinitions>

		<Grid.RowDefinitions>
			<RowDefinition Height="Auto" />
			<RowDefinition Height="7*" />
			<RowDefinition Height="3*" />
		</Grid.RowDefinitions>

		<ListBox x:Name="lstTestRunners" Grid.Column="0" Grid.Row="0" Grid.ColumnSpan="2" 
					 ItemsSource="{Binding TestRuntimes, Mode=OneTime}" 
					 SelectedItem="{Binding SelectedTestRuntime, Mode=TwoWay}" 
					 SelectionChanged="lstTestRunners_SelectionChanged" />

		<TreeView Grid.Column="0" Grid.Row="1" 
					  ItemsSource="{Binding TestResults}" VerticalAlignment="Stretch" 
					  ScrollViewer.CanContentScroll="True" ScrollViewer.HorizontalScrollBarVisibility="Auto" ScrollViewer.VerticalScrollBarVisibility="Auto">
			<TreeView.Resources>
				<Style TargetType="{x:Type TreeViewItem}">
					<Setter Property="HeaderTemplate">
						<Setter.Value>
							<DataTemplate>
								<StackPanel Orientation="Horizontal">
									<Image Source="{Binding ImageSource, Mode=OneWay}" />
									<TextBlock Text="{Binding Text, Mode=OneWay}" Margin="5,0" />
								</StackPanel>
							</DataTemplate>
						</Setter.Value>
					</Setter>
				</Style>
			</TreeView.Resources>
		</TreeView>

		<GridSplitter ResizeDirection="Columns" Grid.Column="0" Grid.Row="1" Width="5" Height="Auto" HorizontalAlignment="Right" VerticalAlignment="Stretch" />
		
		<Grid Grid.Column="1" Grid.Row="1">
			<Grid.RowDefinitions>
				<RowDefinition Height="25" />
				<RowDefinition Height="*" />
				<RowDefinition Height="30" />
			</Grid.RowDefinitions>
			<Label Grid.Row="0" Content="Test Script:" FontWeight="Bold" Height="25" />
			<TextBox Grid.Row="1" 
						 AcceptsReturn="True" AcceptsTab="True" 
						 Text="{Binding TestScriptContent, Mode=TwoWay, NotifyOnTargetUpdated=True, NotifyOnSourceUpdated=True, UpdateSourceTrigger=PropertyChanged}" 
						 TextWrapping="Wrap" VerticalAlignment="Stretch" 
						 ScrollViewer.CanContentScroll="True" ScrollViewer.HorizontalScrollBarVisibility="Auto" ScrollViewer.VerticalScrollBarVisibility="Auto" />
			<Button Grid.Row="2" Content="Run Test" Command="{Binding RunTestCommand}" Height="30" />
		</Grid>
		
		<TextBox Grid.Column="0" Grid.ColumnSpan="2" Grid.Row="2" Text="{Binding TestOutput, Mode=OneWay}" 
					 IsReadOnly="True" VerticalAlignment="Stretch"
					 ScrollViewer.CanContentScroll="True" ScrollViewer.HorizontalScrollBarVisibility="Auto" ScrollViewer.VerticalScrollBarVisibility="Auto" />

		<GridSplitter ResizeDirection="Rows" Grid.Column="0" Grid.ColumnSpan="2" Grid.Row="2" 
					  Height="5" HorizontalAlignment="Stretch" VerticalAlignment="Top" />
	</Grid>
</Window>